package com.example.spring_native_es.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Product {
    private static final String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
    private static final SimpleDateFormat SIMPLEDATEFORMAT = new SimpleDateFormat(TIME_FORMAT);

    static {
        System.out.println(TIME_FORMAT);
    }
    private Long id;

    private String name;

    private BigDecimal price;
    // 不加这个写到es会变成值类型
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = Product.TIME_FORMAT)
    private Date startTime;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = Product.TIME_FORMAT)
    private Date endTime;

}
